
#ifdef a
//struct与class的区别
//1. 类的默认访问权限  
		//struct:public
		//class: private

//2. 类模板
		//template <class/typename T>,不能为struct

//3. 默认的继承权限
		//class : private
		//struct: public

#include<iostream>
using namespace std;
class Base {
public:
	int _pub;
protected:
	int _pro;
private:
	int _pri;
};

class Child : Base//默认继承权限为private
{
	void Test(){
		_pub = 1;//private
		_pro = 2;//private
		//_pri = 3;-->不可访问
	}
};

/*
class Little : public Child
{
	void Test() {
		//_pub = 0;
		//_pro = 1;
		//_pri = 2;
		//均不可访问
	}
};
*/


//不改名同样会重定义
struct Child1 : Base//默认继承权限为public
{
	void Test() {
		_pub = 1;//public
		_pro = 2;//protected
		//_pri = 3;-->不可访问
	}
};


class Little : public Child1
{
	void Test() {
		_pub = 1;
		_pro = 2;//类外不可访问，子类可访问，基类中为保护
		//_pri = 3;//不可访问
	}
};

int main() {
	Child d;
	//d._pub = 1;
	//d._pro = 2;
	//d._pri = 3;/

	Child1 d1;
	d1._pub = 1;
	//d1._pro = 2;//不可访问
	//d1._pri = 3;//不可访问
}

#endif



